home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_include / ASM-SPAR.{_A / SMP.H < prev    next >
C/C++ Source or Header  |  1999-09-17  |  3KB  |  127 lines

  1. /* smp.h: Sparc64 specific SMP stuff.
  2.  *
  3.  * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
  4.  */
  5.  
  6. #ifndef _SPARC64_SMP_H
  7. #define _SPARC64_SMP_H
  8.  
  9. #include <linux/tasks.h>
  10. #include <asm/asi.h>
  11.  
  12. #ifndef __ASSEMBLY__
  13. /* PROM provided per-processor information we need
  14.  * to start them all up.
  15.  */
  16.  
  17. struct prom_cpuinfo {
  18.     int prom_node;
  19.     int mid;
  20. };
  21.  
  22. extern int linux_num_cpus;    /* number of CPUs probed  */
  23. extern struct prom_cpuinfo linux_cpus[64];
  24.  
  25. #endif /* !(__ASSEMBLY__) */
  26.  
  27. #ifdef __SMP__
  28.  
  29. #ifndef __ASSEMBLY__
  30.  
  31. /* Per processor Sparc parameters we need. */
  32.  
  33. /* Keep this a multiple of 64-bytes for cache reasons. */
  34. struct cpuinfo_sparc {
  35.     /* Dcache line 1 */
  36.     unsigned long    irq_count;
  37.     unsigned long    bh_count;
  38.     unsigned int    multiplier;
  39.     unsigned int    counter;
  40.     unsigned long    udelay_val;
  41.  
  42.     /* Dcache line 2 */
  43.     unsigned int    pgcache_size;
  44.     unsigned int    pgdcache_size;
  45.     unsigned long    *pte_cache;
  46.     unsigned long    *pgd_cache;
  47.     unsigned int    idle_volume;
  48.     unsigned int    __pad;
  49.  
  50.     /* Dcache lines 3 and 4 */
  51.     unsigned int    irq_worklists[16];
  52. };
  53.  
  54. extern struct cpuinfo_sparc cpu_data[NR_CPUS];
  55.  
  56. /*
  57.  *    Private routines/data
  58.  */
  59.  
  60. extern unsigned char boot_cpu_id;
  61. extern unsigned long cpu_present_map;
  62.  
  63. /*
  64.  *    General functions that each host system must provide.
  65.  */
  66.  
  67. extern void smp_callin(void);
  68. extern void smp_boot_cpus(void);
  69. extern void smp_store_cpu_info(int id);
  70.  
  71. extern __volatile__ int cpu_number_map[NR_CPUS];
  72. extern __volatile__ int __cpu_logical_map[NR_CPUS];
  73.  
  74. extern __inline__ int cpu_logical_map(int cpu)
  75. {
  76.     return __cpu_logical_map[cpu];
  77. }
  78.  
  79. extern __inline__ int hard_smp_processor_id(void)
  80. {
  81.     extern int this_is_starfire;
  82.  
  83.     if(this_is_starfire != 0) {
  84.         extern int starfire_hard_smp_processor_id(void);
  85.  
  86.         return starfire_hard_smp_processor_id();
  87.     } else {
  88.         unsigned long upaconfig;
  89.         __asm__ __volatile__("ldxa    [%%g0] %1, %0"
  90.                      : "=r" (upaconfig)
  91.                      : "i" (ASI_UPA_CONFIG));
  92.         return ((upaconfig >> 17) & 0x1f);
  93.     }
  94. }
  95.  
  96. #define smp_processor_id() (current->processor)
  97.  
  98. /* This needn't do anything as we do not sleep the cpu
  99.  * inside of the idler task, so an interrupt is not needed
  100.  * to get a clean fast response.
  101.  *
  102.  * Addendum: We do want it to do something for the signal
  103.  *           delivery case, we detect that by just seeing
  104.  *           if we are trying to send this to an idler or not.
  105.  */
  106. extern __inline__ void smp_send_reschedule(int cpu)
  107. {
  108.     extern void smp_receive_signal(int);
  109.     if(cpu_data[cpu].idle_volume == 0)
  110.         smp_receive_signal(cpu);
  111. }
  112.  
  113. /* This is a nop as well because we capture all other cpus
  114.  * anyways when making the PROM active.
  115.  */
  116. extern __inline__ void smp_send_stop(void) { }
  117.  
  118. #endif /* !(__ASSEMBLY__) */
  119.  
  120. #define PROC_CHANGE_PENALTY    20
  121.  
  122. #endif /* !(__SMP__) */
  123.  
  124. #define NO_PROC_ID        0xFF
  125.  
  126. #endif /* !(_SPARC64_SMP_H) */
  127.